package wowmobile;

import java.util.Comparator;

public class OrderComp implements Comparator<Order> {

    public int compare(Order a, Order b) {
        if (a.isPlayerormonster() && b.isPlayerormonster()) {
            return b.getPlayer().getStats().getSpeed() - a.getPlayer().getStats().getSpeed();
        } else if (a.isPlayerormonster() && !b.isPlayerormonster()) {
            return b.getMonster().getSpeed() - a.getPlayer().getStats().getSpeed();
        } else if (!a.isPlayerormonster() && b.isPlayerormonster()) {
            return b.getPlayer().getStats().getSpeed() - a.getMonster().getSpeed();
        } else {
            return b.getMonster().getSpeed() - a.getMonster().getSpeed();
        }
    }
}
